﻿'Friend Class Handler_FileSignatures
'    Private Sub New()
'    End Sub

'    Public Shared Function GenerateItemFileSignatures(ByVal itemRootPath As String, ByVal files As Generic.List(Of Entities.SharedItemFile)) As String
'        Dim aTmp As New Generic.List(Of Entities.FileSignature)
'        For Each clsFile As Entities.SharedItemFile In files
'            Dim strFilePath As String = IO.Path.Combine(clsFile.Directory, clsFile.FileName)
'            If Not strFilePath.ToLower.StartsWith(itemRootPath.ToLower) Then Throw New ArgumentException(String.Format("File {0} is not in the root path {1} of the item!", strFilePath, itemRootPath))
'            strFilePath = strFilePath.Substring(itemRootPath.Length)
'            While strFilePath.StartsWith(IO.Path.DirectorySeparatorChar) Or strFilePath.StartsWith(IO.Path.AltDirectorySeparatorChar)
'                strFilePath = strFilePath.Substring(1)
'            End While
'            Dim clsSig As New Entities.FileSignature
'            clsSig.Filename = clsFile.FileName
'            clsSig.Size = clsFile.Size
'            clsSig.SHA512Hash = clsFile.SHA512Hash
'            aTmp.Add(clsSig)
'        Next
'        'we return a Base64 string instead of just the xml to scramble it just a bit
'        Dim aXml() As Byte = Framework.Serialization.ToXmlBytes(aTmp)
'        Return System.Convert.ToBase64String(aXml)
'    End Function

'    Public Shared Function GetFileSignatures(ByVal itemFileSignatures As String) As Generic.List(Of Entities.FileSignature)
'        Dim aXml() As Byte = System.Convert.FromBase64String(itemFileSignatures)
'        Return Framework.Serialization.FromXmlBytes(Of Generic.List(Of Entities.FileSignature))(aXml)
'    End Function

'End Class
